/* Javascript Image Gallary
	Javascript Code File
	Code By: HackBaby , www.mohamed12777.in
	You are free to Use Or modify this code
*/
	var Imageslist =new Array();
	var count=0;
	var current=0;
	var play=0;
	var pt;
	var t,op=0;
	
    function LoadImages(){
		addImage ('1.jpg');
        addImage ('2.jpg');
        addImage ('3.jpg');
        addImage ('4.jpg');
        addImage ('5.jpg');
		addImage ('6.jpg');
		addImage ('7.jpg');
		addImage ('8.jpg');
		addImage ('9.jpg');
		addImage ('10.png');
		addImage ('11.png');
		addImage ('12.png');
               
       setImage();
    }

    function addImage(url){
           
        Imageslist[count]=url;
        count++;    
    }
	
    function next()
    {
        if(current >= (Imageslist.length-1))
           current=0;
        else
            current ++;

       setImage();
    }
    
    function prev()
    {
        if(current <= 0)
           current = Imageslist.length-1;
        else
            current --;

       setImage();
    }
	
	function setImage()
    {
        document.getElementById("tmpImg").src=Imageslist[current];
		var tmpImg=document.getElementById("tmpImg");
		if(tmpImg.complete && !(op >0 && op < 100))
		{
			document.getElementById("img").src=Imageslist[current];
			ImgOpen();
			document.getElementById("loadImg").width="0";
			clearTimeout(loadT);
			
		}else{
			loadT=setTimeout("setImage()",10);
			document.getElementById("loadImg").width="35";
		}
		
    }

	function PlayPause()
	{
		if(play==0)
			{
				play=1;
				document.getElementById("plypus").src="stuff/pause.png";
				pt=setTimeout("playSlideShow()",3000);
			}else
			{
				play=0;
				document.getElementById("plypus").src="stuff/play.png";
				clearTimeout(pt);
			}
	}
	
	function playSlideShow()
	{
		pt=setTimeout("playSlideShow()",3000);
		next();
	}

	function ImgOpen()
	{
	op++;
			
	img=document.getElementById("img");
	setOpacity(img,op);
	t=setTimeout("ImgOpen()",10);

	if(op>=100)
		{
		op=0;
		clearTimeout(t);
		}
	}

   function setOpacity(obj, opacity) {
        
        opacity = (opacity == 100)?99.999:opacity;
        
        // IE/Win
        obj.style.filter = "alpha(opacity:"+opacity+")";
  
        // Safari<1.2, Konqueror
        obj.style.KHTMLOpacity = opacity/100;
  
        // Older Mozilla and Firefox
        obj.style.MozOpacity = opacity/100;
  
        // Safari 1.2, newer Firefox and Mozilla, CSS3
        obj.style.opacity = opacity/100;
    }

	function MouseOver(id)
	{
		if(id=="plypus" )
			{
				if(play==0)
					document.getElementById(id).src= "stuff/overplay.png";
				else
					document.getElementById(id).src= "stuff/overpause.png";
			
			}else{
			document.getElementById(id).src= "stuff/over" + id + ".png";
		}
		
	}
	
	function MouseOut(id)
	{
		if(id=="plypus" )
			{
				if(play==0)
					document.getElementById(id).src= "stuff/play.png";
				else
					document.getElementById(id).src= "stuff/pause.png";
			
			}else{
		document.getElementById(id).src= "stuff/" + id + ".png";
		}
	}